import request from '@/utils/request'


// **************商品质检中心**********************

          // *****类别管理*********
export function qualityClassList (data) { //质检类别管理列表
  return request({
    url: '/mall-quality/quality-category/search',
    method: 'get',
    params : data
  })
}

export function addqualityClass (data,method) { //添加修改质检类别
  return request({
    url: '/mall-quality/quality-category',
    method: method,
    data
  })
}
export function delqualityClass (qualifyCategoryId) { //删除质检类别
  return request({
    url: '/mall-quality/quality-category',
    method: 'DELETE',
    data : qualifyCategoryId
  })
}
        // *****选项属性管理*********
export function optionList (data) { //选项列表
  return request({
    url: '/mall-quality/quality-attr/search',
    method: 'get',
    params : data
  })
}
export function addAttribute (data,method) { //添加修改属性
  return request({
    url: '/mall-quality/quality-attr',
    method: method,
    data
  })
}
export function delAttribute (attrId) { //删除属性类别
  return request({
    url: '/mall-quality/quality-attr',
    method: 'DELETE',
    data : attrId
  })
}
export function delreport (reportId) { //报告删除
  return request({
    url: '/mall-quality/quality-report',
    method: 'DELETE',
    data : reportId
  })
}
        // *****选项属性值管理*********
export function attrValList (data) { //属性值列表
  return request({
    url: '/mall-quality/quality-attr/detail',
    method: 'get',
    params : data
  })
}
export function addattrVal (data,method) { //添加修改属性值
  return request({
    url: '/mall-quality/quality-attr/val',
    method: method,
    data
  })
}
export function delAttrVal (attrValId) { //删除属性值
  return request({
    url: '/mall-quality/quality-attr/val',
    method: 'DELETE',
    data : attrValId
  })
}
       // *****报告管理*********
export function addreport (data,method) { //添加修改报告
 return request({
   url: '/mall-quality/quality-report',
   method: method,
   data
 })
}
export function reportdetail (reportId) { //报告想去
 return request({
   url: '/mall-quality/quality-report/detail',
   method: 'get',
   params : {reportId}
 })
}

        // *****科目管理*********
export function courseList (data) { //科目列表
  return request({
    url: '/mall-quality/quality-subject/search',
    method: 'get',
    params : data
  })
}
export function addcourse (data,method) { //添加修改科目
  return request({
    url: '/mall-quality/quality-subject',
    method: method,
    data
  })
}
export function addoption (data,method) { //质检选项组-新增或者更新选项（属性）
  return request({
    url: '/mall-quality/quality-group/option',
    method: method,
    data
  })
}
export function delcourse (attrValId) { //删除科目
  return request({
    url: '/mall-quality/quality-subject',
    method: 'DELETE',
    data : attrValId
  })
}
export function getcourseList (subjectId) { //根据科目id获取一下的组
  return request({
    url: '/mall-quality/quality-group/list-by-subject',
    method: 'get',
    params : {subjectId}
  })
}
      // *****科目添加分组管理*********
export function groupingList (data) { //分组列表
  return request({
    url: '/mall-quality/quality-group/list-by-subject',
    method: 'get',
    params : data
  })
}
export function addgrouping (data,method) { //添加修改分组
  return request({
    url: '/mall-quality/quality-group',
    method: method,
    data
  })
}
export function delgrouping (groupId) { //删除分组
  return request({
    url: '/mall-quality/quality-group',
    method: 'DELETE',
    data : groupId
  })
}

// **************质检人员管理**********************
export function qualityUserList (data) { //质检人员-列表
  return request({
    url: '/mall-quality/quality-user/search',
    method: 'get',
    params : data
  })
}
export function addQualityUser (data,method) { //添加修改人员
  return request({
    url: '/mall-quality/quality-user',
    method: method,
    data
  })
}
export function delQualityUser (qualityUserId) { //删除人员
  return request({
    url: '/mall-quality/quality-user',
    method: 'DELETE',
    data: qualityUserId
  })
}
export function upLoadingImg (data) { //上传图片
  return request({
    url: '/osscenter/upfile/img/base64/only',
    method: 'post',
    data
  })
}


export function reportList (data) { //质检人员-列表
  return request({
    url: '/mall-quality/quality-report/search',
    method: 'get',
    params : data
  })
}
export function allQualityUserList (data) { //所有质检人员-列表
  return request({
    url: '/mall-quality/quality-user/list',
    method: 'get',
    params : data
  })
}
export function allCourseList (data) { //所有科目-列表
  return request({
    url: '/mall-quality/quality-subject/list',
    method: 'get',
    params : data
  })
}

// **************质检流程管理**********************

export function flowList (data) { //流程列表
  return request({
    url: '/mall-quality/quality-procedure/search',
    method: 'get',
    params : data
  })
}
export function flowDetails (procedureId) { //流程详情
  return request({
    url: '/mall-quality/quality-procedure',
    method: 'get',
    params : {procedureId}
  })
}
export function addflow (data,method) { //添加流程
  return request({
    url: '/mall-quality/quality-procedure',
    method: method,
    data
  })
}
export function delFlow (id) { //删除流程
  return request({
    url: '/mall-quality/quality-procedure',
    method: 'DELETE',
    data : id
  })
}

// **************商品推荐管理**********************

            // *****热门搜索*********
export function hotList (data) { //热搜列表
  return request({
    url: '/mall-recommend/hotsearch',
    method: 'get',
    params : data
  })
}
export function delHot (id) { //删除热搜
  return request({
    url: '/mall-recommend/hotsearch/' + id,
    method: 'DELETE',
  })
}
export function addRecommend (data,method) { //添加更新热搜
  return request({
    url: '/mall-recommend/hotsearch',
    method: method,
    data
  })
}
        // *****推荐类型(楼层)*********
export function floorList (data) { //楼层列表
  return request({
    url: '/mall-recommend/floor',
    method: 'get',
    params : data
  })
}
export function getRecommendProduct (id) { //根据楼层ID 获取推荐商品列表
  return request({
    url: '/mall-recommend/recommend/list/' + id,
    method: 'get',
  })
}
export function addFloor (data,method) { //添加更新楼层
  return request({
    url: '/mall-recommend/floor/goods',
    method: method,
    data
  })
}
export function delFloor (id) { //删除楼层
  return request({
    url: '/mall-recommend/floor/' + id,
    method: 'DELETE',
  })
}

// ************分类管理*********************

export function getShoptreeList () { //商品分类-分类树
    return request({
      url: '/mall-goods/mall-goods-category/tree',
      method: 'GET'
    })
}

export function addShopClassify (data) { //商品分类-新增
    return request({
      url: '/mall-goods/mall-goods-category/tree',
      method: 'POST',
      data
    })
}

export function getattrLists (data) { //商品分类关联属性-分页查询
    return request({
      url: '/mall-goods/mall-goods-category/attrs/search',
      method: 'get',
      params:data
    })
}

export function handleClassify (data,method) { //商品分类-新增、编辑、删除
    return request({
      url: '/mall-goods/mall-goods-category',
      method: method,
      data
    })
}

export function getClassifyDetail (data) { //商品分类-详情
    return request({
      url: '/mall-goods/mall-goods-category',
      method: "get",
      params:data
    })
}

export function handleAttr (data,method) { //商品分类关联属性-新增、编辑、删除
    return request({
      url: '/mall-goods/mall-goods-category/attrs',
      method: method,
      data
    })
}


// ************属性管理*********************

export function attrLists (data) { //商品属性名-查询（分页）
    return request({
      url: '/mall-goods/mall-goods-attr/name/search',
      method: 'GET',
      params:data
    })
}

export function attrNameDetails(data) { //商品属性名-详情
    return request({
      url: '/mall-goods/mall-goods-attr/name',
      method: "GET",
      params:data
    })
}

export function editAttrName(data,method) { //商品属性名-编辑修改删除
    return request({
      url: '/mall-goods/mall-goods-attr/name',
      method: method,
      data
    })
}

export function delAttrName(data) { //商品属性名-编辑修改删除
    return request({
      url: '/mall-goods/mall-goods-attr/name',
      method:"DELETE",
      data
    })
}

export function AttrValDetails(data) { //商品属性值-详情
    return request({
      url: '/mall-goods/mall-goods-attr/name',
      method: "GET",
      params:data
    })
}

export function editAttrVal(data,method) { //商品属性值-编辑修改删除
    return request({
      url: '/mall-goods/mall-goods-attr/name',
      method: method,
      params:data
    })
}

export function getAttrValueList(data) { //商品属性名-查询某个属性名称下的所有属性值
    return request({
      url: '/mall-goods/mall-goods-attr/name/vals',
      method:"GET",
      params:data
    })
}

export function editAttrValue(data,method) { //商品属性值-新增/修改/删除
    return request({
      url: '/mall-goods/mall-goods-attr/val',
      method:method,
      data
    })
}
export function allProductList (data) { //拉取所有商品
    return request({
      url: '/mall-goods/mall-goods/search',
      method :'get',
      params : data
    })
}
export function relevanceProduct (floorId,ids,method) { //创建关联推荐商品
    return request({
      url: '/mall-recommend/recommend/' + floorId +'/'+ ids,
      method : method,
    })
}
export function getFloorList(data) { //商品属性值-新增/修改/删除
    return request({
      url: '/mall-recommend/recommend',
      method:"GET",
      params:data
    })
}


// ************订单管理*********************

export function getOrderList(data) { //商品属性值-新增/修改/删除
    return request({
      url: '/mall-oms/mall/order/list',
      method:"GET",
      params:data
    })
}
export function allSeo (data) { //SEO
    return request({
      url: '/mall-goods/mall-goods-seo',
      method :'post',
      data
    })
}
export function seodetails (goodsId) { //SEO详情
    return request({
      url: '/mall-goods/mall-goods-seo',
      method :'get',
      params : {goodsId}
    })
}
export function allsepcs (data,method) { //新增之定义属性
    return request({
      url: '/mall-goods/mall-goods-sepcs',
      method : method,
      data
    })
}
export function sepcsList (goodsId) { //商品-自定义属性-查询
    return request({
      url: '/mall-goods/mall-goods-sepcs/goods/' + goodsId,
      method :'get',
    })
}
export function delspecs (specsId) { //商品-自定义属性-删除
    return request({
      url: '/mall-goods/mall-goods-sepcs',
      method :'DELETE',
      data : specsId
    })
}
export function goodsPutaway (data) { //商品上线、下线
    return request({
      url: '/mall-goods/mall-goods/online',
      method :'post',
      data
    })
}
export function delgoods (goodsId) { //删除商品
    return request({
      url: '/mall-goods/mall-goods',
      method :'DELETE',
      data : goodsId
    })
}
export function goodsBasicDetails (goodsId) { //商品详情（基本信息+属性+自定义参数）
    return request({
      url: '/mall-goods/mall-goods/detail',
      method :'get',
      params : {goodsId}
    })
}
